package web.hibernate;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Basic;
import javax.persistence.Column;
import java.util.Arrays;

/**
 * Created by IntelliJ IDEA.
 * User: user
 * Date: Jan 31, 2010
 * Time: 9:14:59 PM
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(catalog = "strutshibernatespring", name = "drugs")
public class DrugsEntity {
  private long drugId;

  @Basic
  @Column(name = "drug_id", length = 10)
  public long getDrugId() {
    return drugId;
  }

  public void setDrugId(long drugId) {
    this.drugId = drugId;
  }

  private char[] drugName;

  @Basic
  @Column(name = "drug_name", length = 5000)
  public char[] getDrugName() {
    return drugName;
  }

  public void setDrugName(char[] drugName) {
    this.drugName = drugName;
  }

  private long firmId;

  @Basic
  @Column(name = "firm_id", length = 10)
  public long getFirmId() {
    return firmId;
  }

  public void setFirmId(long firmId) {
    this.firmId = firmId;
  }

  private long cntryId;

  @Basic
  @Column(name = "cntry_id", length = 10)
  public long getCntryId() {
    return cntryId;
  }

  public void setCntryId(long cntryId) {
    this.cntryId = cntryId;
  }

  private long objId;

  @Basic
  @Column(name = "obj_id", length = 10)
  public long getObjId() {
    return objId;
  }

  public void setObjId(long objId) {
    this.objId = objId;
  }

  private long invalid;

  @Basic
  @Column(name = "invalid", length = 10)
  public long getInvalid() {
    return invalid;
  }

  public void setInvalid(long invalid) {
    this.invalid = invalid;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) return true;
    if (o == null || getClass() != o.getClass()) return false;

    DrugsEntity that = (DrugsEntity) o;

    if (cntryId != that.cntryId) return false;
    if (drugId != that.drugId) return false;
    if (firmId != that.firmId) return false;
    if (invalid != that.invalid) return false;
    if (objId != that.objId) return false;
    if (!Arrays.equals(drugName, that.drugName)) return false;

    return true;
  }

  @Override
  public int hashCode() {
    int result = (int) (drugId ^ (drugId >>> 32));
    result = 31 * result + (drugName != null ? Arrays.hashCode(drugName) : 0);
    result = 31 * result + (int) (firmId ^ (firmId >>> 32));
    result = 31 * result + (int) (cntryId ^ (cntryId >>> 32));
    result = 31 * result + (int) (objId ^ (objId >>> 32));
    result = 31 * result + (int) (invalid ^ (invalid >>> 32));
    return result;
  }
}
